package com.booksystem.campuslibrarymanagementsystem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.booksystem.campuslibrarymanagementsystem.commen.request.userquest.BookBorrowrequst.Approval;
import com.booksystem.campuslibrarymanagementsystem.commen.request.userquest.BookReturnrequst.Returnbook;
import com.booksystem.campuslibrarymanagementsystem.commen.result.userresuilt.ReturnTable;
import com.booksystem.campuslibrarymanagementsystem.entity.BorrowApprovalsTable;
import com.booksystem.campuslibrarymanagementsystem.entity.ReservationTable;
import com.booksystem.campuslibrarymanagementsystem.entity.ReturnrequesTable;
import com.booksystem.campuslibrarymanagementsystem.mapper.ReturnrequesTableMapper;
import com.booksystem.campuslibrarymanagementsystem.service.ReturnrequesTableService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

@Service
public class ReturnrequesTableServiceImpl extends ServiceImpl<ReturnrequesTableMapper, ReturnrequesTable> implements ReturnrequesTableService {
    @Autowired
    ReturnrequesTableMapper returnrequesTableMapper;

    @Override
    public int add(ReturnrequesTable cc){
        return returnrequesTableMapper.add(cc);
    }

    @Override
    public   List<ReturnrequesTable> existsByAccountAndBookidi(String account, int bookid){
        return  returnrequesTableMapper.existsByAccountAndBookidi(account,bookid);
    }
    @Override
    public List<ReturnTable> returnlist(@Param("account") String account){
        return returnrequesTableMapper.returnlist(account);
    }

    @Override
    public List<ReturnTable> returnliststatus(String account, String approvalstate){
        return returnrequesTableMapper.returnliststatus(account,approvalstate);
    }

    @Override
    public  int deleteByAccountAndBookid(@Param("account") String account, @Param("returnid") int returnid){
        return returnrequesTableMapper.deleteByAccountAndBookid(account,returnid);
    }
    @Override
    public List<BorrowApprovalsTable> ddd(@Param("account") String account, @Param("bookid") int bookid){
        return returnrequesTableMapper.ddd(account,bookid);
    }

    @Override
    public List<ReturnrequesTable> queryByAccount(String account) {
        return returnrequesTableMapper.queryByAccount(account);
    }

    @Override
    public void unapproval(String account, LocalDate approvalTime, String bookid,String Approvalstate) {
        returnrequesTableMapper.unapproval(account,approvalTime,bookid,Approvalstate);
    }

    @Override
    public void onapproval(String account, LocalDate approvalTime, String bookid,String Approvalstate) {
        returnrequesTableMapper.onapproval(account,approvalTime,bookid,Approvalstate);
    }


    @Override
    public List<ReturnrequesTable> querydislist(String approvalstate) {
        return returnrequesTableMapper.querydislist(approvalstate);
    }
}
